"""
__author__ = 'berlinyoung'
@File   :editmember_page.py
@Date   :2021/10/7 10:10
-*- coding: utf-8 -*-
"""
from appium.webdriver.common.mobileby import MobileBy

from test_app.test_po5.page.base_page import BasePage


class EditMemberPage(BasePage):

    input_name_element=(MobileBy.XPATH,"//*[contains(@text,'姓名')]/../android.widget.EditText")
    input_phonenum_element = (MobileBy.XPATH,"//*[contains(@text,'手机')]/..//*[@text='必填']")
    save_button_element = (MobileBy.XPATH, "//*[@text='保存']")

    def edit_member(self,name,phonenum):
        # input[姓名]
        # input[手机号]
        # click[保存]
        self.find_and_send(*self.input_name_element,name)
        self.find_and_send(*self.input_phonenum_element,phonenum)
        self.find_and_click(*self.save_button_element)
        # self.driver.find_element(MobileBy.XPATH,
        #                          "//*[contains(@text,'姓名')]/../android.widget.EditText").send_keys(name)
        # self.driver.find_element(MobileBy.XPATH,
        #                          "//*[contains(@text,'手机')]/..//*[@text='必填']").send_keys(phonenum)
        # self.driver.find_element(MobileBy.XPATH, "//*[@text='保存']").click()
        from test_app.test_po5.page.addmember_page import AddMemberPage
        return AddMemberPage(self.driver)